< previous page page_271 next page >

Page 271
the current row after you update the recordset (as in the case of Edit) or move to the last row in the recordset (as in the case of AddNew).
After updating the recordset with the new record, you need to move to the last row in the recordset if youre adding a new record. All new rows are added to the end of the recordset, so you need to apply the MoveLast method to position yourself on this new record. After youre positioned on the new record, call the ToggleButtons routine to reset the command buttons and the data control back to their normal state. Youll see the code for this ToggleButtons routine later in the chapter.

Detecting Changes in Data
When you want to add the ability to save data programmatically instead of having the data control save it when the user moves off the changed record, you need to start understanding all the Change events that occur when you modify data in the bound controls.
The Change events are those events that occur when you modify data in data-bound controls such as text boxes. This modification can happen either by the user typing a new value into a control or by moving to a new record in the data control. These data-bound controls communicate changes to the ADO data control so that it can fire its events in response to these changes.
If youre just saving the changed record using the Update method of the Recordset object of the data control, a certain event order will occur:
WillChangeRecord
WillChangeField
FieldChangeComplete
RecordChangeComplete
If youve changed data in the bound controls and then click a button on the data control to move to a new record, a different event order occurs:
WillMove
WillChangeField
FieldChangeComplete

 
< previous page page_271 next page >

If you like this book, buy it!